package cn.wxz1997.permission.config;

import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @Description: ${todo}
 * @Author: wxz1997
 * @Date 18-8-6上午12:04
 */
@Configuration
public class MyWebConfigurer implements WebMvcConfigurer {
    /**
     * 跨域配置
     * @param registry
     */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedMethods("GET", "POST", "DELETE", "PUT");
    }

    /**
     * modelMapper注入,pojo到model或dto的映射
     */
    @Bean
    public ModelMapper modelMapper(){
        return new ModelMapper();
    }
}
